package org.zqy.action;

import java.util.List;

import org.zqy.domain.Article;
import org.zqy.service.ArticleService;
import org.zqy.service.UserService;
import org.zqy.service.impl.ArticleServiceImpl;
import org.zqy.service.impl.UserServiceImpl;

/**
 * 处理登录界面
 * 
 * @author zqy
 * 
 */
@SuppressWarnings("serial")
public class Main extends BaseAction {

	/** 发稿排行榜 */
	private List<Article> articleRankList;

	/** 处理登录 */
	public String login() {
		String uaccount = getRequest().getParameter("uaccount");
		String password = getRequest().getParameter("password");
		UserService us = new UserServiceImpl();
		if (us.isRight(uaccount, password)) {
			System.out.println("登录成功");
			return "admin";
		}
		return ERROR;
	}

	/** 初始化发稿排行榜 */
	public void initArticleRank() {
		ArticleService cs = new ArticleServiceImpl();
		setArticleRankList(cs.getRankList());
	}

	public void setArticleRankList(List<Article> articleRankList) {
		this.articleRankList = articleRankList;
	}
}
